package org.vsg.security.model.service;

import java.io.Serializable;
import java.util.Collection;

import org.springframework.dao.DataAccessException;
import org.vsg.common.biz.exception.ServiceException;
import org.vsg.common.pagination.Pagination;
import org.vsg.common.pagination.PaginationException;
import org.vsg.common.pagination.carrier.Carrier;
import org.vsg.security.model.domain.SysRole;


public interface SysRoleService {

	/**
	 * @param sysRole
	 * @exception ServiceException
	 */
	public void addSysRole(SysRole sysRole) throws ServiceException;

	/**
	 * 
	 * @param allSysRole
	 * @throws DataAccessException
	 */
	public void saveAll(Collection<SysRole> allSysRole) throws ServiceException;


	/**
	 * @param sysRole
	 * @exception ServiceException
	 */   
	public void updateSysRole(SysRole sysRole) throws ServiceException;
	
	
	/**
	 * @param sysRole
	 * @exception ServiceException
	 */   
	public void updateSimpleSysRole(SysRole sysRole) throws ServiceException;

	
	/**
	 * @param pk -- primary key for loading entity
	 * @exception ServiceException
	 */   
	public SysRole loadSysRole(Serializable pk) throws ServiceException;
	
	
	/**
	 * @param sysRole
	 * @exception ServiceException
	 */   
	public void deleteSysRole(SysRole sysRole) throws ServiceException;
	
	/**
	 * 
	 */
	public void removeRoles(int[] ids) throws ServiceException;


	/**
	 * 
	 * @param all
	 * @throws DataAccessException
	 */
	public void deleteAll(Collection<SysRole> all) throws ServiceException;

	
	
	/**
	 * 
	 * @param sysRole
	 * @throws ServiceException
	 */
	public void markDeleteSysRole(SysRole sysRole) throws ServiceException;	
	
	
   	/** 
   	 * @param carrier
   	 * @exception ServiceException
   	 * @exception PaginationException
   	 */
   	public Pagination pageSysRole(Carrier carrier) throws ServiceException, PaginationException;
   
   
   	/** 
   	 * @param carrier
     * @exception ServiceException
     * @exception PaginationException
     *
     */
   	public Pagination pageSysRoleByAll(Carrier carrier) throws ServiceException, PaginationException;

   	/**
   	 * 
   	 * @param carrier
   	 * @return
   	 * @throws ServiceException
   	 * @throws PaginationException
   	 */
	public Pagination pageUndefinedHierarchyRoles(Carrier carrier) throws  ServiceException , PaginationException;
   	
	/**
	 * 
	 * @param carrier
	 * @return
	 * @throws ServiceException
	 * @throws PaginationException
	 */
	public Pagination pageAvailableConflictRole(Carrier carrier) throws ServiceException , PaginationException;
	
	/**
	 * 
	 * @param carrier
	 * @return
	 * @throws ServiceException
	 * @throws PaginationException
	 */
	public Pagination pageAvailableHierarchyRolesForOne(Carrier carrier) throws ServiceException , PaginationException;

	/**
	 * 
	 * @param carrier
	 * @return
	 * @throws ServiceException
	 * @throws PaginationException
	 */
	public Pagination pageAvailableHierarchyRoles(Carrier carrier) throws ServiceException , PaginationException;
	
	
	public Pagination pageAvailableRolesOfUser(Carrier carrier) throws ServiceException , PaginationException;
	
   	/**
   	 * 
   	 * @param carrier
   	 * @return
   	 * @throws ServiceException
   	 * @throws PaginationException
   	 */
   	public Pagination pageSysRoleHierarchy(Carrier carrier) throws ServiceException, PaginationException;
   	
   	/**
   	 * show the select all defined
   	 * @return
   	 * @throws ServiceException
   	 */
	public Collection<SysRole> findByAll() throws ServiceException;

	/**
	 * get the role 
	 * @param code
	 * @return
	 * @throws ServiceException
	 */
	public SysRole getByCode(String code) throws ServiceException;
	
	/**
	 * 
	 * @param mainRole
	 * @param beLongRoles
	 * @throws ServiceException
	 */
	public void updateRoleHierarchy(SysRole mainRole , String[] beLongRoles) throws ServiceException;
	
	
	public void addRoleConflict(SysRole mainRole , String[] roleIds) throws ServiceException;
	
	public void removeRoleConflict(SysRole mainRole , String[] roleIds) throws ServiceException;
	
	
}